import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const store = new Vuex.Store({
  state: {
    userinfo: {
      uid: '1',
      uname: '',
      uhead_img: '',
      mobile: '15112345678',
      openid: 13213212313,
    },
    addressinfo: {
      province: '',
      city: '',
      country: '',
      province_id: '',
      city_id: '',
      country_id: ''
    },
    storeinfo: {
      store_name: '',
      store_id: '',
    },

    bank_name: '',
    bank_id: '',
    bankcard_id: '',
    bankcard_name:'',

    balace_money: '',

    address_id: '',
    address_name: '',
    address_username: '',
    address_userphone: '',

    choosebankinfo: {
      id: '',
      nameinfo:''
    }
  },
  mutations: {
    setUserinfo(state, data) {
      state.userinfo = data;
    },
    setaddressinfo(state, data) {
      state.addressinfo = data;
    },
    //修改用户手机号码
    setUserPhone(state, data) {
      state.userinfo.mobile = data;
    },
    setaddressid(state, data) {
      state.address_id = data;
    },
    setaddresscityinfo(state, data) {
      state.address_name = data;
    },
    setstoreinfo(state, data) {
      state.storeinfo = data;
    },
    setaddressusername(state, data) {
      state.address_username = data;
    },
    setaddressuserphone(state, data) {
      state.address_userphone = data;
    },
    setbankname(state, data) {
      state.bank_name = data;
    },
    setbankid(state, data) {
      state.bank_id = data;
    },
    setmoney(state, data) {
      state.balace_money = data;
    },
    setchoosebankinfo(state, data) {
      state.choosebankinfo = data;
    },
  }
})

export default store;
